package com.itheima.hello.hello入门进阶.JavaBean封装.基础知识;

import com.itheima.hello.hello入门进阶.JavaBean封装.基础知识.Student;

public class studentOp {
    private Student student; //实例化一个Student对象(student) 作为studentOp的成员变量(属性)

    public studentOp(Student student) {  //有参构造器
        this.student = student;
    }

    public studentOp() {  //无参构造器
    }
    public void printPass(){
        if (student.getChinese()>=60){
            System.out.println("语文成绩及格");
        }else {
            System.out.println("语文成绩不及格");
        }
        if (student.getEnglish()>=60){
            System.out.println("英语成绩及格");
        }else {
            System.out.println("英语成绩不及格");
        }
    }
    public void totalScore(){
        System.out.println(student.getName() + "的总分为:" + (student.getChinese()+student.getEnglish()));
    }
    public void avgScore(){
        System.out.println(student.getName() + "的平均分为:" + (student.getChinese()+student.getEnglish())/2.0);
    }

    public void printDetail() {
        System.out.println("姓名:" + student.getName() + " 年龄:" + student.getAge() + " 语文成绩:" + student.getChinese() + " 英语成绩:" + student.getEnglish());
    }

}
